package study.wy.linkedlist.single;

/**
 * 单向链表节点
 * @author wy
 */
public class SingleLinkedNote<T> {
    /**
     * 节点的id值，用于排序
     */
    private int id;
    /**
     * 节点存储的数据
     */
    private T data;
    /**
     * 指向下一个节点的地址
     */
    public SingleLinkedNote<T> next;

    public SingleLinkedNote(int id, T data) {
        this.id = id;
        this.data = data;
    }

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public T getData() {
        return data;
    }

    public void setData(T data) {
        this.data = data;
    }

    @Override
    public String toString() {
        return "SingleLinkedNote{" +
                "id=" + id +
                ", data=" + data +
                '}';
    }

    @Override
    public void finalize(){
        System.out.println(this+"，被删除了");
    }
}
